﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.IO;

namespace FrameDisplay.Services
{

    [ServiceContract(Namespace="http://calevinci.com/2010/FrameDisplay")]  
    public interface IFrameDisplayService
    {
        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "About")]
        Stream About();

        [OperationContract]
        [WebInvoke(
            Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "Version")]
        int Version();

        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "HideFrame?k={accessCode}")]
        void HideFrame(string accessCode);

        [OperationContract]
        [WebInvoke(
            Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "ShowUrl?url={url}&k={accessCode}")]
        void ShowUrl(string accessCode, string url);

        [OperationContract]
        [WebInvoke(
            Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "ShowYouTube?v={videoID}&k={accessCode}")]
        void ShowYouTube(string accessCode, string videoID);

        [OperationContract]
        [WebInvoke(
            Method = "POST",            
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "ShowImageFile?k={accessCode}")]
        void ShowImageFile(Stream image, string accessCode);

        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "GetImageForCursorRegion?k={accessCode}&w={width}&h={height}")]
        Stream GetImageForCursorRegion(string accessCode, int width, int height);


        /// <summary>
        /// Sends a mouse event to the server at the mouse's current location.
        /// </summary>
        /// <param name="accessCode"></param>
        /// <param name="button">Left, Right, or Middle.</param>
        /// <param name="action">Down, Up, or Click.</param>
        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "MousePress?k={accessCode}&b={button}&a={action}")]
        void MousePress(string accessCode, string button, string action);


        /// <summary>
        /// Moves mouse position.
        /// </summary>
        /// <param name="accessCode"></param>
        /// <param name="deltaX"></param>
        /// <param name="deltaY"></param>
        /// <param name="absolute">If true, coordinate change is absolute, rather than using trackpad acceleration.</param>
        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "MouseMove?k={accessCode}&dx={deltaX}&dy={deltaY}&a={absolute}")]
        void MouseMove(string accessCode, int deltaX, int deltaY, bool absolute);


        [OperationContract]
        [WebInvoke(
            Method = "GET",
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "SendKeys?k={accessCode}&keys={keys}")]
        void SendKeys(string accessCode, string keys);
    }


}
